package myJs

import myJs.myPkg.i18n._

import scala.scalajs.js

/**
 * Created by yz on 28/3/2022
 */
object I18n {

  val en = "en"
  val enTexts = js.Dictionary(
    "ascendingSort" -> "Ascending sort",
    "descendingSort" -> "Descending sort",
    "noMatches" -> "No matching records found",
    "sortingConditions" -> "Sorting conditions",
    "screening" -> "Screening",
    "fuzzy" -> "Fuzzy",
    "accurate" -> "Accurate",
    "screeningPlaceholder" -> "Multiple conditions use ; separate,example:\nA;B;C",
    "filteringAndSort" -> "Filtering and sort",
    "confirm" -> "Confirm",
    "close" -> "Close",
    "formatShowingRows" ->" Showing {{pageFrom}} to {{pageTo}} of {{totalRows}} rows ",
    "eachPageShow" ->" ",
    "formatRecordsPerPage" ->" rows per page"
  )

  val zh = "zh"
  val zhTexts = js.Dictionary(
    "ascendingSort" -> "升序排序",
    "descendingSort" -> "降序排序",
    "noMatches" -> "没有找到匹配的记录",
    "sortingConditions" -> "排序条件",
    "screening" -> "条件/文本检索",
    "fuzzy" -> "模糊搜索",
    "accurate" -> "精确搜索",
    "screeningPlaceholder" -> "多个条件用;分开,例:\nA;B;C",
    "filteringAndSort" -> "筛选条件",
    "confirm" -> "确定",
    "close" -> "关闭",
    "formatShowingRows" ->s" 显示第 {{pageFrom}} 到第 {{pageTo}} 条记录，总共 {{totalRows}} 条记录 ",
    "eachPageShow" ->" 每页显示 ",
    "formatRecordsPerPage" ->" 条记录"

  )


  def initialize() = i18n.use(ReactI18next.initReactI18next).init(InitOptions(resources = js.Dictionary(
    en -> js.Dictionary("translation" -> enTexts),
    zh -> js.Dictionary("translation" -> zhTexts)
  ), fallbackLng = zh, lng = zh, react = ReactOptions(useSuspense = true),
    interpolation = InterpolationOptions(escapeValue = false)))


}
